/**
 * Created by Administrator on 2016/3/31.
 */
angular.module('myApp',[])
    .factory('Data',function(){
        return {
            item:{
                title:'站点配置',

            },
            items: {
                title:'挂载',
                class:'active',
                url:'#',
            }
        };
    })
.controller('menuController',function($scope,$http,Data){
        var url = "index.php?r=module/module-nav/nav";
        /*$http.get(url).success(function(response){
            $scope.data=response;
        }).error(function(){
            alert('错误');
        });*/
    $http({
        method: 'GET',
        url: url,
    }).success(function(response) {

     $scope.data=response;
    })
        .error(function(data, status, headers, config) {
     alert('错误');
        });
       /* $scope.data=[
            {
                title:'管理主页',
                class:'start',
                icon:'icon-home',
                arrow:false,
                select:'',

            },
            {
                title:'站点配置',
                class:'active',
                icon:'icon-cogs',
                arrow:true,
                select:'selected',
                ul:[
                    {
                        title:'url',
                        class:'',
                        url:'#',
                    },
                    {
                        title:'菜单',
                        class:'',
                        url:'#',
                    },
                    {
                        title:'挂载',
                        class:'active',
                        url:'#',
                    }
                ]
            },
            {
                title:'系统用户',
                class:'',
                icon:'icon-cogs',
                arrow:false,
                select:'selected',
                ul:[
                    {
                        title:'管理员',
                        class:'',
                        url:'#',
                    },
                    {
                        title:'用户',
                        class:'',
                        url:'#',
                    },
                    {
                        title:'权限',
                        class:'',
                        url:'#',
                    }
                ]
            },
        ];*/
        $scope.showNav = function(item,items){
            Data.item=item;
            Data.items=items;
            //Data={item:item,items:items};/*这样写不对*/
        }
    $scope.Data=Data;

    })
.controller('urlController',function($scope,Data){
        $scope.Data=Data;
    });